<?php
/**
 * Class describes an User object.
 * @author Hugo Zonderland
 *
 */
class User extends ClassBase {
	
	public $id;
	public $username;
	public $password;
	public $emailadres;
	public $firstname;
	public $insertion;
	public $lastname;
	public $companyname;
	public $country;
	public $zipcode;
	public $address;
	public $addition;
	public $dateofbirth;
	public $phonenumber;
	public $active;
	
	/**
	 * Default constructor.
	 * Initialise the ClassBase class
	 * @see ClassBase::__construct()
	 */
	public function __construct() {
		$this->class = "User";
		$this->tablename = "user";
	
		$this->fields = array("id", "username", "password", "emailaddress", "firstname", "insertion", "lastname", "companyname", "country", "zipcode", "address", "addition", "dateofbirth", "phonenumber", "active");
	}
	
	/**
	 * Is used to authenticate and authorize an user.
	 * @param String $username
	 * @param unknown $password
	 * @return boolean
	 */
	public function checkLogin($username, $password) {
		$this-> username = $username;
		$this-> firstname = "Frank";
		$this-> insertion = "the";
		$this-> lastname = "Tank";
		return true;
	}
	
	/**
	 * Adds a user to the database
	 * @param User $user to be added
	 * @return boolean if succeeded
	 */
	public function register(User $user) {
		$this->save($user);
	}
}